package com.wangjie.math;

/**
 * 计算 -10.8到5.9之间绝对值 大于6 小于2.1的整数数有多少个
 */
public class MathDemo2 {
    public static void main(String[] args) {
        double start = -10.8;
        double end = 5.9;
        System.out.println(Math.ceil(start));
        System.out.println(Math.ceil(end));
        int realStart = (int) Math.ceil(start);
        int realEnd = (int) Math.ceil(end);
        int count = 0;
        while (realStart < realEnd) {
            if (Math.abs(realStart) < 2.1 || Math.abs(realStart) > 6) {
                ++count;
                System.out.println(realStart);
            }
            realStart++;
        }
        System.out.println(count);
    }
}
